//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ReShade effect file
// visit facebook.com/MartyMcModding for news/updates
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// Advanced Ambient Obscurance with Indirect Lighting 1.7 by Marty McFly
// Special edition for VisualV mod. 
// Copyright © 2008-2016 Marty McFly
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


#define fMXAOAmbientOcclusionAmount		2.0	//[0.0 to 2.0]	Linearly increases AO intensity. Can cause pitch black clipping if set too high.
#define bMXAOIndirectLightingEnable		1	//[0 or 1] 	Enables Indirect Lighting calculation. Will cause a major fps hit.
#define fMXAOIndirectLightingAmount		8.0	//[0.0 to 8.0] 	Linearly increases IL intensity.
#define fMXAOIndirectLightingSaturation  	0.7	//[0.0 to 3.0]	Boosts IL saturation for more pronounced effect. 

#define fMXAOSampleRadius 			50.0	//[0.5 to 10.0] Sample radius of GI, higher values drop performance.
#define iMXAOSampleCount 			64	//[5 to 150] 	Amount of MXAO samples. Higher means more accurate and less noisy AO at the cost of fps.
#define bMXAOSmartSamplingEnable		1	//[0 or 1]	Enables smart sample count reduction for far areas. May look ugly when low sample count (16 or less) is used, turn it off then.
#define fMXAOSampleRandomization		0.25	//[0.0 to 1.0]  Breaks up the dither pattern a bit if sample spiral gets too visible (low samples and/or high radius). Needs stronger blurring though.
#define fMXAONormalBias 			0.2	//[0.05 to 0.4] Normals bias to reduce self-occlusion of surfaces that have a low angle to each other.
#define bMXAOBackfaceCheckEnable		0	//[0 or 1]	For indirect lighting only! Enables back face check so surfaces facing away from the source position don't cast light. It comes with a slight fps drop.
#define bMXAOPerPixelNormalsEnable		0	//[0 or 1]	Enables fake per pixel normals embossed from colors. My version is edge aware and distance stable. Adds more detail but may look comic-like. Best for old games.
#define bMXAOLowPrecisionEnable			1	//[0 or 1]	Enables lower bit mode for AO source texture (R32F vs R16F). This will improve performance but may introduce some artifacts at distant objects.
#define fMXAOBlurSharpness			1.0	//[0.00 to 2.0] AO sharpness, higher means more sharp geometry edges but noisier AO, less means smoother AO but blurry in the distance.
#define fMXAOBlurSteps				4	//[2 to 7] 	Offset count for AO smoothening. Higher means more smooth AO but also blurrier AO.

#define fMXAOSizeScale				0.5	//[0.5 to 1.0] 	Resolution scale in which AO is being calculated.
#define fMXAOMipLevelIL				4	//[0 to 4]      Miplevel of IL texture. 0 = fullscreen, 1 = 1/2 screen width/height, 2 = 1/4 screen width/height and so forth. 
#define fMXAOMipLevelAO				2	//[0 to 2]	Miplevel of AO texture. 0 = fullscreen, 1 = 1/2 screen width/height, 2 = 1/4 screen width/height and so forth. Best results: IL MipLevel = AO MipLevel + 2
#define bMXAODebugViewEnable			0	//[0 or 1]	Enables raw AO/IL output for debugging and tuning purposes.


#define AO_FADE____START 		0.0
#define AO_FADE____END   		1.0

#define EXTRASUNNY_FADEOUT 		1.0
#define CLEAR_FADEOUT 			1.0
#define NEUTRAL_FADEOUT 		1.0
#define SMOG_FADEOUT			0.5
#define FOGGY_FADEOUT			0.4
#define OVERCAST_FADEOUT		1.0
#define CLOUDS_FADEOUT			0.9
#define CLEARING_FADEOUT		0.8
#define RAIN_FADEOUT			0.7
#define THUNDER_FADEOUT			0.4
#define SNOW_FADEOUT			0.5
#define BLIZZARD_FADEOUT		0.4
#define LIGHTSNOW_FADEOUT		0.8
#define XMAS_FADEOUT			0.6
#define NULL_FADEOUT			0.0



texture2D texLOD 		{ Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; MipLevels = 5+fMXAOMipLevelIL; };

#if(bMXAOLowPrecisionEnable != 0)
texture2D texDepthLOD 	{ Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = R16F;  MipLevels = 5+fMXAOMipLevelAO; };
#else
texture2D texDepthLOD 	{ Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = R32F;  MipLevels = 5+fMXAOMipLevelAO; };
#endif

#if(bMXAOBackfaceCheckEnable != 0)
texture2D texNormal		{ Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; MipLevels = 5+fMXAOMipLevelIL; };
#else
texture2D texNormal		{ Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
#endif

texture2D texSSAO	{ Width = BUFFER_WIDTH*fMXAOSizeScale; Height = BUFFER_HEIGHT*fMXAOSizeScale; Format = RGBA8; };
texture2D texDither  <string source = "ReShade/bayermatrix16.png";> { Width = 16;Height = 16;Format = R8;};

sampler2D SamplerLOD
{
	Texture = texLOD;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = LINEAR;
	AddressU = Clamp;
	AddressV = Clamp;
};

sampler2D SamplerDepthLOD
{
	Texture = texDepthLOD;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = LINEAR;
	AddressU = Clamp;
	AddressV = Clamp;
};

sampler2D SamplerNormal
{
	Texture = texNormal;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = LINEAR;
	AddressU = Clamp;
	AddressV = Clamp;
};

sampler2D SamplerSSAO
{
	Texture = texSSAO;
	MinFilter = LINEAR;
	MagFilter = LINEAR;
	MipFilter = LINEAR;
	AddressU = Clamp;
	AddressV = Clamp;
};

sampler2D SamplerDither
{
	Texture = texDither;
	MinFilter = POINT;
	MagFilter = POINT;
	MipFilter = POINT;
	AddressU = Wrap;
	AddressV = Wrap;
};

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

float3 GetPosition(float2 coords)
{
	float EyeDepth = GetLinearDepth(coords.xy)*1000.0;
	return float3((coords.xy*2.0-1.0)*EyeDepth, EyeDepth);
}

float3 GetPositionLOD(float2 coords, int mipLevel)
{
	float EyeDepth = tex2Dlod(SamplerDepthLOD, float4(coords.xy,0,mipLevel)).x;
	return float3((coords.xy*2.0-1.0)*EyeDepth, EyeDepth);
}

float3 GetNormalFromDepth(float2 coords) 
{
	float3 centerPos = GetPosition(coords.xy);
	float2 offs = PixelSize.xy*1.0;
	float3 ddx1 = GetPosition(coords.xy + float2(offs.x, 0)) - centerPos;
	float3 ddx2 = centerPos - GetPosition(coords.xy + float2(-offs.x, 0));

	float3 ddy1 = GetPosition(coords.xy + float2(0, offs.y)) - centerPos;
	float3 ddy2 = centerPos - GetPosition(coords.xy + float2(0, -offs.y));

	ddx1 = lerp(ddx1, ddx2, abs(ddx1.z) > abs(ddx2.z));
	ddy1 = lerp(ddy1, ddy2, abs(ddy1.z) > abs(ddy2.z));

	float3 normal = cross(ddy1, ddx1);	
	
	return normalize(normal);
}

float3 GetNormalFromColor(float2 coords, float2 offset, float scale, float sharpness)
{
	const float3 lumCoeff = float3(0.299,0.587,0.114);

    	float hpx = dot(tex2Dlod(SamplerColor, float4(coords + float2(offset.x,0.0),0,0)).xyz,lumCoeff) * scale;
    	float hmx = dot(tex2Dlod(SamplerColor, float4(coords - float2(offset.x,0.0),0,0)).xyz,lumCoeff) * scale;
    	float hpy = dot(tex2Dlod(SamplerColor, float4(coords + float2(0.0,offset.y),0,0)).xyz,lumCoeff) * scale;
    	float hmy = dot(tex2Dlod(SamplerColor, float4(coords - float2(0.0,offset.y),0,0)).xyz,lumCoeff) * scale;

    	float dpx = GetLinearDepth(coords + float2(offset.x,0.0));
    	float dmx = GetLinearDepth(coords - float2(offset.x,0.0));
    	float dpy = GetLinearDepth(coords + float2(0.0,offset.y));
    	float dmy = GetLinearDepth(coords - float2(0.0,offset.y));

	float2 xymult = float2(abs(dmx - dpx), abs(dmy - dpy)) * sharpness; 
	xymult = max(0.0, 1.0 - xymult);
    	
    	float ddx = (hmx - hpx) / (2.0 * offset.x) * xymult.x;
    	float ddy = (hmy - hpy) / (2.0 * offset.y) * xymult.y;
    
    	return normalize(float3(ddx, ddy, 1.0));
}

float3 GetBlendedNormals(float3 n1, float3 n2)
{
     	float3x3 nBasis = float3x3(float3(n1.z, n1.y, -n1.x), 
        			   float3(n1.x, n1.z, -n1.y), 
        			   float3(n1.x, n1.y,  n1.z));
	
    	return normalize(n2.x*nBasis[0] + n2.y*nBasis[1] + n2.z*nBasis[2]);
}

float4 GetBlurFactors(float2 coords)
{
	return float4(tex2Dlod(SamplerNormal, float4(coords.xy,0,0)).xyz*2.0-1.0,GetLinearDepth(coords.xy));
}

float GetBlurWeight(float r, float4 z, float4 z0)
{
	float normaldiff = distance(z.xyz,z0.xyz);
	float depthdiff = abs(z.w-z0.w);

	float depthfalloff = pow(max(0.0,1.0-z0.w),3.0);
	float fresnelfactor  = min(dot(z0.xyz,float3(0.0,0.0,-1.0)),dot(z.xyz,float3(0.0,0.0,-1.0))); 

	float normalweight = max(0.0,1.0-normaldiff * fMXAOBlurSharpness);
	float depthweight = max(0.0,1.0-depthdiff * 1000.0 * fMXAOBlurSharpness * fresnelfactor * depthfalloff);
	
	return min(depthweight,normalweight);
}

float2 GetRandom2FromCoord(float2 coords)
{
	coords *= 1000.0;
	float3 coords3 = frac(float3(coords.xyx) * 0.1031);
    	coords3 += dot(coords3.xyz, coords3.yzx+19.19);
    	return frac(float2((coords3.x + coords3.y)*coords3.z, (coords3.x+coords3.z)*coords3.y));
}

float ComputeFadeOut()
{
	float3 fadeoutTex = tex2D(SamplerLOD, float2(0.0, 0.0)).rgb;
	
	[flatten]
	if (fadeoutTex.b < 1.0)
	{
		return 0.0f;
	}
	
	int R = fadeoutTex.r * 255;
	
	int w0 = (R & 0x000000F0) >> 4;
	int w1 = R & 0x0000000F;
	
	static const float weathers[15] = {
		EXTRASUNNY_FADEOUT,
		CLEAR_FADEOUT,
		CLOUDS_FADEOUT,
		SMOG_FADEOUT,
		FOGGY_FADEOUT,
		OVERCAST_FADEOUT,
		RAIN_FADEOUT,
		THUNDER_FADEOUT,
		CLEARING_FADEOUT,
		NEUTRAL_FADEOUT,
		SNOW_FADEOUT,
		BLIZZARD_FADEOUT,
		LIGHTSNOW_FADEOUT,
		XMAS_FADEOUT,
		NULL_FADEOUT
	};
	
	return lerp(weathers[w0], weathers[w1], fadeoutTex.g);
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

void PS_AO_Pre(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 color : SV_Target0, out float4 depth : SV_Target1, out float4 normal : SV_Target2)
{
	color = tex2D(SamplerColor, texcoord.xy);
	depth = GetLinearDepth(texcoord.xy)*1000.0;
	normal = float4(GetNormalFromDepth(texcoord.xy),depth.x);

#if(bMXAOPerPixelNormalsEnable != 0)
	float FresnelFactor = max(0.0,dot(normal.xyz,float3(0.0,0.0,-1.0)));
	float3 ppnormal = GetNormalFromColor(texcoord.xy, 40.0 * PixelSize.xy / depth.x, 0.2 / depth.x, 1000.0 * FresnelFactor);
	normal.xyz = GetBlendedNormals(normal.xyz,ppnormal.xyz);
#endif
	normal.xyz = normal.xyz * 0.5 + 0.5;
}

void PS_AO_Gen(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 res : SV_Target0)
{
	float3 ScreenSpaceNormals = tex2D(SamplerNormal, texcoord.xy).xyz * 2.0 - 1.0; 
	float3 ScreenSpacePosition = GetPositionLOD(texcoord.xy, 0);
	float scenedepth = ScreenSpacePosition.z * 0.001;
	
	float fadeout = ComputeFadeOut();

	float numSamples = iMXAOSampleCount * lerp(1.0,0.125,scenedepth * fadeout); //AO FADEOUT
	float2 SampleRadiusScaled  = fMXAOSampleRadius / (numSamples * ScreenSpacePosition.z * float2(1.0,PixelSize.x/PixelSize.y));
	SampleRadiusScaled *= 1.0 + fMXAOSampleRandomization*(GetRandom2FromCoord(texcoord.xy)-0.5); 

	float rotAngle = tex2D(SamplerDither, texcoord.xy * float2(BUFFER_WIDTH,BUFFER_HEIGHT) * fMXAOSizeScale * 0.0625).x;
	float mipFactor = SampleRadiusScaled.x*numSamples*20.0;

	float4 AOandGI = 0.0;

	float2x2 radialMatrix = float2x2(0.7756,-0.6313,0.6313,0.7756); //E.F
	float2 currentVector = float2(cos(rotAngle*6.28), sin(rotAngle*6.28));

	[loop]
    for (float i=1.0; i <= numSamples; i++) 
	{
		currentVector = mul(currentVector.xy,  radialMatrix);
		float2 currentOffset = texcoord.xy + currentVector.xy * SampleRadiusScaled.xy * i;

		[branch]
		if(max(currentOffset.x,currentOffset.y) >= 1.0 || min(currentOffset.x,currentOffset.y) <= 0.0) continue;

		int mipLevel = clamp((int)floor(log2(mipFactor*i)) - 3, fMXAOMipLevelAO, 5); //AO must not go beyond 5

		float3 offsetPosition = GetPositionLOD(currentOffset.xy, mipLevel);
		float3 occlVec = offsetPosition - ScreenSpacePosition;
  		float occlDistance = length(occlVec);
 		float SurfaceAngle = dot(normalize(occlVec), ScreenSpaceNormals);

		float fAO = max(fMXAOSampleRadius - occlDistance, 0.0) * max(SurfaceAngle- fMXAONormalBias,0.0); 
		AOandGI.w += fAO;

		#if(bMXAOIndirectLightingEnable != 0)
			#if(bMXAOBackfaceCheckEnable != 0)
				float3 offsetNormals = tex2Dlod(SamplerNormal, float4(currentOffset,0,mipLevel + fMXAOMipLevelIL)).xyz * 2.0 - 1.0; 
				float facingtoSource = dot(-normalize(occlVec),offsetNormals);
				facingtoSource = smoothstep(-0.5,0.0,facingtoSource); 
				fAO *= facingtoSource;
			#endif
			AOandGI.xyz += tex2Dlod(SamplerLOD, float4(currentOffset,0,mipLevel + fMXAOMipLevelIL)).xyz * fAO;
		#endif
	}

	AOandGI *= 10.0 / ((1.0-fMXAONormalBias)*numSamples*fMXAOSampleRadius); 
	AOandGI.xyz *= 3.0;
	AOandGI.w = max(0.0,1.0-AOandGI.w);
	AOandGI.w = (pow(AOandGI.w , 0.35) + 1.2 * pow(AOandGI.w,4.0)) / 2.2; //almost 1:1 from McGuire, neat anti-tonemap.
		 
	res = lerp(AOandGI,float4(0.0.xxx,1.0), fadeout < scenedepth); //AO FADEOUT

}

void PS_AO_Blur1(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 res : SV_Target0)
{
	float4 center_factor = GetBlurFactors(texcoord.xy);
	float4 temp_factor = 0.0;

	float totalweight = 1.0;
	float tempweight = 0.0;

	float4 total_ao = tex2Dlod(SamplerSSAO, float4(texcoord.xy,0,0));
	float4 temp_ao = 0.0;

	[loop]
	for(float r = 1.0; r <= fMXAOBlurSteps; r += 1.0)
	{
		float2 axis = float2(-r,r)/fMXAOSizeScale*1.0;

		temp_factor = GetBlurFactors(texcoord.xy + axis * PixelSize.xy);
		temp_ao = tex2Dlod(SamplerSSAO, float4(texcoord.xy + axis * PixelSize.xy,0,0));
		tempweight = GetBlurWeight(r, temp_factor, center_factor);

		total_ao += temp_ao * tempweight;
		totalweight += tempweight;

		temp_factor = GetBlurFactors(texcoord.xy - axis * PixelSize.xy);
		temp_ao = tex2Dlod(SamplerSSAO, float4(texcoord.xy - axis * PixelSize.xy,0,0));
		tempweight = GetBlurWeight(r, temp_factor, center_factor);

		total_ao += temp_ao * tempweight;
		totalweight += tempweight;
	}

	total_ao /= totalweight;

	res = total_ao;
}

void PS_AO_Blur2(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 res : SV_Target0)
{
	float4 center_factor = GetBlurFactors(texcoord.xy);
	float4 temp_factor = 0.0;

	float totalweight = 1.0;
	float tempweight = 0.0;

	float4 total_ao = tex2Dlod(SamplerColor, float4(texcoord.xy,0,0));
	float4 temp_ao = 0.0;

	[loop]
	for(float r = 1.0; r <= fMXAOBlurSteps; r += 1.0)
	{
		float2 axis = float2(r,r)/fMXAOSizeScale;

		temp_factor = GetBlurFactors(texcoord.xy + axis * PixelSize.xy);
		temp_ao = tex2Dlod(SamplerColor, float4(texcoord.xy + axis * PixelSize.xy,0,0));
		tempweight = GetBlurWeight(r, temp_factor, center_factor);

		total_ao += temp_ao * tempweight;
		totalweight += tempweight;

		temp_factor = GetBlurFactors(texcoord.xy - axis * PixelSize.xy);
		temp_ao = tex2Dlod(SamplerColor, float4(texcoord.xy - axis * PixelSize.xy,0,0));
		tempweight = GetBlurWeight(r, temp_factor, center_factor);

		total_ao += temp_ao * tempweight;
		totalweight += tempweight;
	}
	
	total_ao /= totalweight;

	res = total_ao;


	float4 mxao = saturate(total_ao);

	float scenedepth = GetLinearDepth(texcoord.xy); //might change center_factor so better fetch depth directly here.
	float4 color = max(0.0,tex2D(SamplerLOD, texcoord.xy)); 
	
	[flatten]
	if (!(texcoord.x < PixelSize.x && texcoord.y < PixelSize.y) && !(texcoord.x > 1.0-PixelSize.x && texcoord.y < PixelSize.y) && !(texcoord.x < PixelSize.x && texcoord.y > 1.0-PixelSize.y))
	{
		
		float colorgray = dot(color.xyz,float3(0.299,0.587,0.114));
		float3 colorn = normalize(color.xyz+0.5);
		
		float fadeout = ComputeFadeOut();

		mxao.xyz  = lerp(dot(mxao.xyz,float3(0.299,0.587,0.114)),mxao.xyz,fMXAOIndirectLightingSaturation) * fMXAOIndirectLightingAmount;
		mxao.w    = pow(mxao.w, fMXAOAmbientOcclusionAmount);
		mxao.w    = lerp(mxao.w, 1.0, pow(colorgray,2.0));
		mxao.w    = lerp(mxao.w,1.0,smoothstep(AO_FADE____START, fadeout, scenedepth)); 	//AO FADEOUT
		mxao.xyz  = lerp(mxao.xyz,0.0,smoothstep(AO_FADE____START*0.5, fadeout*0.5, scenedepth)); 	//AO FADEOUT
		
	#if(bMXAOIndirectLightingEnable != 0)	
		color.xyz += color.xyz * (1.0 - colorgray) * mxao.xyz; // * mxao.w;
		color.xyz *= mxao.w;
	#else
		color.xyz *= lerp(2.0*colorn.xyz*mxao.w, 1.0-2.0*(1.0-colorn.xyz)*(1.0-mxao.w), step(0.5,mxao.w));
	#endif 

	#if(bMXAODebugViewEnable != 0)
		#if(bMXAOIndirectLightingEnable != 0)
			color.xyz = (texcoord.x > 0.5) ? mxao.xyz : mxao.w * 0.7;
		#else
			color.xyz = mxao.w * 0.7;
		#endif 
	#endif
	}
/*#if (AmbientLight_Effect == 0)
	else
	{
		color = tex2D(SamplerLOD, float2(PixelSize.x*2.0f, PixelSize.y));
	}
	[flatten]
	if (texcoord.x > 1.0 - PixelSize.x && texcoord.y < PixelSize.y)
	{
		color = tex2D(SamplerLOD, float2(1.0 - PixelSize.x*2.0f, PixelSize.y));
	}
#endif*/
	

 	res = color;

}

/*void PS_AO_Blend(float4 vpos : SV_Position, float2 texcoord : TEXCOORD, out float4 res : SV_Target0)
{
	float scenedepth = GetLinearDepth(texcoord.xy); //might change center_factor so better fetch depth directly here.
	float4 color = max(0.0,tex2D(SamplerLOD, texcoord.xy)); 
	float colorgray = dot(color.xyz,float3(0.299,0.587,0.114));
	float3 colorn = normalize(color.xyz+0.5);

	float4 mxao = tex2D(SamplerColor, texcoord.xy);
	mxao = min(mxao, tex2D(SamplerColor, texcoord.xy + float2(1.0,1.0)*PixelSize.xy*1.5));
	mxao = min(mxao, tex2D(SamplerColor, texcoord.xy + float2(1.0,-1.0)*PixelSize.xy*1.5));
	mxao = min(mxao, tex2D(SamplerColor, texcoord.xy + float2(-1.0,1.0)*PixelSize.xy*1.5));
	mxao = min(mxao, tex2D(SamplerColor, texcoord.xy + float2(-1.0,-1.0)*PixelSize.xy*1.5));


	mxao.w    = lerp(mxao.w,1.0,smoothstep(AO_FADE____START, AO_FADE____END, scenedepth)); 	//AO FADEOUT
	//if(scenedepth < 1.0) color.xyz *= 1.0 + mxao.w*mxao.w*mxao.w * normalize(float3(140,170,240))*0.3;

	res = color;

}*/

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

technique MXAO < bool enabled = MXAO_Effect; toggle = 0x79;>
{
	pass P0
	{
		VertexShader = RFX_VS_PostProcess;
		PixelShader  = PS_AO_Pre;
		RenderTarget0 = texLOD;
		RenderTarget1 = texDepthLOD;
		RenderTarget2 = texNormal;
	}
	pass P1
	{
		VertexShader = RFX_VS_PostProcess;
		PixelShader  = PS_AO_Gen;
		RenderTarget = texSSAO;
	}
	pass P2_0
	{
		VertexShader = RFX_VS_PostProcess;
		PixelShader  = PS_AO_Blur1;
	}
	pass P2_1
	{
		VertexShader = RFX_VS_PostProcess;
		PixelShader  = PS_AO_Blur2;
	}
/*	pass P3
	{
		VertexShader = RFX_VS_PostProcess;
		PixelShader  = PS_AO_Blend;
	}*/
}


#pragma message "Advanced Ambient Obscurance with Indirect Lighting 1.7 by Marty McFly\nfor VisualV\n"